<script src="/js/lib.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGridSorter.js"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGridColumnResizer.js"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGridNodeUI.js"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGridLoader.js"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGridColumns.js"></script>
<script type="text/javascript" src="/js/ux/treegrid/TreeGrid.js"></script>

<script type="text/javascript">
Ext.onReady(function(){
	var treeColumn = [{
	    header: 'Task',
	    dataIndex: 'task',
	    width: 230
	},{
	    header: 'Duration',
	    width: 100,
	    dataIndex: 'duration',
	    align: 'center',
	    sortType: 'asFloat',
	    tpl: new Ext.XTemplate('{duration:this.formatHours}', {
	        formatHours: function(v) {
	            if(v < 1) {
	                return Math.round(v * 60) + ' mins';
	            } else if (Math.floor(v) !== v) {
	                var min = v - Math.floor(v);
	                return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm';
	            } else {
	                return v + ' hour' + (v === 1 ? '' : 's');
	            }
	        }
	    })
	},{
	    header: 'Assigned To',
	    width: 150,
	    dataIndex: 'user'
	}];

	<?php echo $this->layout?>
});
</script>